package com.bee.caf_ss_android.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bee.baselibrary.base.BaseActivity;
import com.bee.baselibrary.utils.ImageLoadUtils;
import com.bee.caf_ss_android.MyApplication;
import com.bee.caf_ss_android.R;
import com.bee.caf_ss_android.common.ListBean;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created time 2018/3/27.
 * Creator 南柯一梦丶 on
 * Personal signature 余生还长 何必慌张
 * Page description :
 */

public class MyListAdapter extends RecyclerArrayAdapter<ListBean.DataBean> {


    public MyListAdapter(Context context) {
        super(context);
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup viewGroup, int i) {
        return new ListHolder(viewGroup);
    }


    public class ListHolder extends BaseViewHolder<ListBean.DataBean> {


        @BindView(R.id.img_head)
        ImageView imgHead;
        @BindView(R.id.tv_name)
        TextView tvName;
        @BindView(R.id.tv_duration)
        TextView tvDuration;
        @BindView(R.id.tv_question)
        TextView tvQuestion;
        @BindView(R.id.tv_time)
        TextView tvTime;

        public ListHolder(ViewGroup parent) {
            super(parent, R.layout.item_list);
            ButterKnife.bind(this, itemView);
        }

        @Override
        public void setData(final ListBean.DataBean data) {
            super.setData(data);

            ImageLoadUtils.ImageLoad(data.headSrc,imgHead, MyApplication.headOptions, BaseActivity.context);
            tvName.setText("姓名："+data.name);
            tvDuration.setText("通话时长："+data.callDuration);
            tvQuestion.setText("电话："+data.phoneNum);
            tvTime.setText(data.begTime);

        }
    }

}
